package haxeframe.physics.fixtures;

import box2D.collision.shapes.B2CircleShape;
import box2D.common.math.B2Vec2;

class FixtureCircle extends Fixture
{
	public function new(xml:Xml, scale:Float, symbolScale:Float)
	{
		super(xml, scale, symbolScale);
	}

	public function FixtureCircle()
	{
	}
	
	public override function init():Void
	{
		super.init();
		
		var circleShape:B2CircleShape = new B2CircleShape(Std.parseFloat(_xml.get('radius')) / _scale);
		
		var circleX:Float = Std.parseFloat(_xml.get('x')) * _symbolScale/_scale;
		var circleY:Float = Std.parseFloat(_xml.get('y'))* _symbolScale/_scale;
		
		circleShape.setLocalPosition(new B2Vec2(circleX, circleY));
		
		definitions[0].shape = circleShape;
	}
}